﻿




$(document).ready(function () {

    var LoginButton = $('div#btnLogin');


    LoginButton.click(function () {

        //will return true if has Error
        if (global.validation.validate("login")) {
            return;
        }

        var Username = $('#Username').val();
        var Password = $('#Password').val(); 

        $.ajax({
            type: "POST",
            url: "/auth/Login",
            data: "Username=" + Username + "&Password=" + Password,
            success: function (msg) {

                if (msg.errCode == 'ok') {
                    window.location.replace(msg.url);
                }
                else {
                    global.modalDialog.showModal('confirmed!', 'your form has been saved.' + msg.errCode);
                }


            },
            error: function () {
                modalDialog.showModal('Error.', 'Cannot save!<br/><br/>There seems to be an unexpected problem.<br/><br/>If the problem persists please relogin or report to:<br/> <u>support@</u>');
            }
        });


    });





});




